#pragma once

#define MAKE_2_POWER_NUM(x)     (unsigned)(unsigned 1 << (x))

struct buddy2;

struct buddy2 *buddy2_new(int size);
void buddy2_destroy(struct buddy2 *self);

int buddy2_alloc(struct buddy2 *self, int size);
void buddy2_free(struct buddy2 *self, int offset);

int buddy2_size(struct buddy2 *self, int offset);
void buddy2_dump(struct buddy2 *self);
void buddy2_dump_tree(struct buddy2 *self);
unsigned buddy2_remaining_size(struct buddy2 *self);

